package com.hejia.alauda.entity;

import javax.persistence.Column;

/**
 * Created by jimi on 14/11/11.
 */
public class TemplateField extends BaseEntity {

    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	//REQUIRED 必须的字段 NOT_REQUIRED 不是必须的字段
    public static enum Required {
        REQUIRED, NOT_REQUIRED
    }

    public static final String REQUIRED = "REQUIRED";
    public static final String NOT_REQUIRED = "NOT_REQUIRED";

    @Column
    private Long templateId;

    @Column
    private String name; //字段名

    @Column
    private String code; //编码

    @Column
    private String type; //类型

    @Column
    private String required; //是否必填

    @Column
    private String css; //模板内容样式

    @Column
    private String order;

    public Long getTemplateId() {
        return templateId;
    }

    public void setTemplateId(Long templateId) {
        this.templateId = templateId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getCss() {
        return css;
    }

    public void setCss(String css) {
        this.css = css;
    }

    public String getOrder() {
        return order;
    }

    public void setOrder(String order) {
        this.order = order;
    }

    public String getRequired() {
        return required;
    }

    public void setRequired(String required) {
        if (REQUIRED.equalsIgnoreCase(required)) {
            this.required = REQUIRED;
        } else if (NOT_REQUIRED.equalsIgnoreCase(required)) {
            this.required = NOT_REQUIRED;
        }  else {
            this.required = NOT_REQUIRED;
        }
    }
}
